import java.util.ArrayList;
import java.util.List;

/**
 * @author LKQ
 * @date 2022/1/5 21:40
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.letterCasePermutation("a1b2");
    }

    public List<String> letterCasePermutation(String s) {
        List<String> ans = new ArrayList<>();
        int n = s.length();
        char[] c = s.toCharArray();
        dfs(c, n, 0, ans);
        return ans;
    }
    public void dfs(char[] chs, int n , int begin, List<String > ans) {
        ans.add(new String(chs));
        for (int i = begin; i < n ; i++) {
            if (!Character.isDigit(chs[i])) {
                // 如果不是数字
                char temp = chs[i];
                // 大小写转换
                chs[i] ^= 32;
                dfs(chs, n, i+1, ans);
                chs[i] = temp;
            }
        }
    }
}
